import { Component, OnInit } from '@angular/core'
import { NzMessageService } from 'ng-zorro-antd'
import { I18NService } from '@core'
import { Router, ActivatedRoute } from '@angular/router'
import { PostRiskService } from '../../post-risk.service'
import { DataService } from '@shared/services/data.service'
import { STColumn } from '@delon/abc'
import { PostRiskStoreService } from '../../new/post-risk-store.service'

@Component({
  selector: 'app-tab-range',
  templateUrl: './tab-range.component.html',
  styleUrls: ['../../../../shared/styles/table.less'],
})
export class TabRangeComponent implements OnInit {
  schemeCode: string
  data: Array<{
    mccCode: string;
    mccEnName: string;
  }> = []
  mcccInfoList: Array<{
    mccCode: string;
    mccEnName: string;
  }> = []
  columns: STColumn[] = [
    {
      title: '商户代码',
      i18n: 'GENERAL.MCC.CODE',
      index: 'mccCode',
      width: '150px',
      className: 'text-center',
    },
    {
      title: '适用范围',
      i18n: 'GENERAL.INFO.RANGE',
      index: 'mccEnName',
      width: '150px',
      className: 'text-center',
    },
  ]

  constructor(
    public msg: NzMessageService,
    public i18n: I18NService,
    public router: Router,
    public route: ActivatedRoute,
    private riskService: PostRiskService,
    private dataService: DataService,
    public riskStore: PostRiskStoreService,
  ) {}

  ngOnInit() {
    this.schemeCode = this.dataService.riskControlScheme.schemeCode
    this.data =
      this.dataService.currentPostRisk$.value.mcccInfoList || this.dataService.origPostRisk$.value.mcccInfoList
  }
}
